from langchain_experimental.agents.agent_toolkits import create_csv_agent
from langchain_openai import ChatOpenAI


key = 'key'
model = ChatOpenAI(model="gpt-3.5-turbo",
                   openai_api_key=key,
                   openai_api_base="https://api.aigc369.com/v1",
                   temperature=0)

csv_agent_executor = create_csv_agent(
    llm=model,
    path="../other/student.csv",verbose=True,
    agent_executor_kwargs={
        "handle_parsing_errors" :True
    },
    allow_dangerous_code=True
)

print(csv_agent_executor.invoke("数据集有几个字段，它们都是什么"))
